﻿using System;
using ReAnimation.MVP.ViewInterfaces;

namespace ReAnimation.MVP.Presenters.Helpers
{
    public class BatchLayoutChange: IDisposable
    {
        private readonly IView _view;

        public BatchLayoutChange(IView view)
        {
            _view = view;
            _view.SuspendLayout();
        }

        public static BatchLayoutChange For(IView view)
        {
            return  new BatchLayoutChange(view);
        }

        public void Dispose()
        {
            _view.ResumeLayout();
        }
    }
}
